<template>

  <!-- 调用流程设计器插件 -->
  <iframe v-show="iframe" name="mainFrame" id="mainFrame" frameborder="0" :src="serverurl+'/editor.html?modelId='+modelId+'&curl='+curl" ></iframe>

</template>

<script>
  export default {
    name: 'EditorModal',
    data(){
      return{
      serverurl: '',	//后台地址
      curl:'',		//当前地址
      modelId: '',	//流程ID
      iframe:false	//是否显示mainFrame
    }

    },

    methods: {


      show(record){
        console.log(record)
        this.iframe=true
        this.modelId=record.ID_
      },


      //初始执行
      init() {

        var mcallback = this.getUrlKey('mcallback');//返回链接参数
        if('ok' == mcallback){
          swal("", "保存成功", "success");
          setTimeout(function(){
            top.Dialog.close();	//关闭弹窗
          },1000);
        }else if('close' == mcallback){
          top.Dialog.close();		//关闭弹窗
        }else{
          this.iframe = true;
        }

        this.serverurl = window._CONFIG['domianURL'];
        this.curl= window.location.href;
        /*var modelId = this.getUrlKey('modelId');//链接参数
        if(null != modelId){
          this.modelId = modelId;
        }*/
        this.cmainFrame();
      },

      //浏览器窗口大小变化时调用
      cmainFrame: function(){
        var hmain = document.getElementById("mainFrame");
        var bheight = document.documentElement.clientHeight;
        hmain.style.width = '100%';
        hmain.style.height = (bheight-5) + 'px';
      },

      //根据url参数名称获取参数值
      getUrlKey: function (name) {
        return decodeURIComponent(
          (new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.href) || [, ""])[1].replace(/\+/g, '%20')) || null;
      }

    },

    mounted(){
      this.init();
    }



  }






</script>

<style scoped>

</style>